package org.example.classloader.ASM;

import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;

import java.util.HashSet;
import java.util.Set;

public class FilterClassVisitor extends ClassVisitor {

    private Set<String> tranMehodSet;

    public FilterClassVisitor() {

        super(Opcodes.ASM5);
        tranMehodSet = new HashSet<>();
    }

    public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {

        MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions);
        return new FilterMethodVisitor(name, methodVisitor, this);
    }

    public void addTranMehod(String methName) {
        tranMehodSet.add(methName);
    }

    public Set<String> getTranMehods() {
        return tranMehodSet;
    }
}